import { Navigate } from "react-router-dom"
import { useSelector } from 'react-redux'
const PERMISSION = ({ children }: any) => {
    const userInfo = useSelector((state: any) => state.userReducer.userInfo)
    const isLogin = Object.values(userInfo).length
    if (isLogin) {
        return <>{children}</>
    } else {
        return <Navigate to="/login" />
    }
}
export default PERMISSION